package chapter01.principle.ocp.improve;

//正确示例：通过抽象接口扩展
interface Shape {
    double calculateArea();
}

class Circle implements Shape {
    public double calculateArea() { /* 圆形面积计算 */
        return 0;
    }
}

class Square implements Shape {
    public double calculateArea() { /* 方形面积计算 */
        return 0;
    }
}
class AreaCalculator {
    public double calculateArea(Shape shape) {
        return shape.calculateArea();
    }
}